import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CompanyInfoVO, CompanyInfoForm, CompanyInfoQuery } from '@/api/system/companyInfo/types';

/**
 * 查询企业账号信息列表
 * @param query
 * @returns {*}
 */

export const listCompanyInfo = (query?: CompanyInfoQuery): AxiosPromise<CompanyInfoVO[]> => {
  return request({
    url: '/electroniccommerce/companyInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询企业账号信息详细
 * @param id
 */
export const getCompanyInfo = (id: string | number): AxiosPromise<CompanyInfoVO> => {
  return request({
    url: '/electroniccommerce/companyInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增企业账号信息
 * @param data
 */
export const addCompanyInfo = (data: CompanyInfoForm) => {
  return request({
    url: '/electroniccommerce/companyInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改企业账号信息
 * @param data
 */
export const updateCompanyInfo = (data: CompanyInfoForm) => {
  return request({
    url: '/electroniccommerce/companyInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除企业账号信息
 * @param id
 */
export const delCompanyInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/electroniccommerce/companyInfo/' + id,
    method: 'delete'
  });
};
